Magentix2
2.1.1
|
Classes | |
class | ACTION_Method |
class | AGREE_Method |
class | BEGIN_Method |
class | FAILURE_Method |
class | FINAL_Method |
class | INFORM_Method |
class | NOT_UNDERSTOOD_Method |
class | RECEIVE_REQUEST_Method |
class | REFUSE_Method |
Public Member Functions | |
Jason_Fipa_RequestW_Participant (String sagName, TransitionSystem ts, AgentID aid, int iTO) | |
ConvCFactory | newFactory (String name, MessageFilter filter, int availableConversations, ConvJasonAgent myAgent) |
Public Attributes | |
int | TimeOut |
String | TaskResult = "" |
String | TaskDesition = "" |
String | RequestResult = "" |
String | Task = "" |
Protected Member Functions | |
void | doBegin (CProcessor myProcessor, ACLMessage msg) |
String | doReceiveRequest (ConvCProcessor myProcessor, ACLMessage request) |
void | doNotUnderstood (ConvCProcessor myProcessor, ACLMessage messageToSend) |
void | doRefuse (ConvCProcessor myProcessor, ACLMessage messageToSend) |
void | doAgree (ConvCProcessor myProcessor, ACLMessage messageToSend) |
String | doAction (ConvCProcessor myProcessor) |
void | doFailure (ConvCProcessor myProcessor, ACLMessage messageToSend) |
void | doInform (ConvCProcessor myProcessor, ACLMessage response) |
void | doFinal (ConvCProcessor myProcessor, ACLMessage messageToSend) |
Protected Attributes | |
TransitionSystem | Ts |
Definition at line 34 of file Jason_Fipa_RequestW_Participant.java.
es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.Jason_Fipa_RequestW_Participant | ( | String | sagName, |
TransitionSystem | ts, | ||
AgentID | aid, | ||
int | iTO | ||
) |
Definition at line 49 of file Jason_Fipa_RequestW_Participant.java.
String es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doAction | ( | ConvCProcessor | myProcessor | ) | [protected] |
Perform the requested action
myProcessor | the CProcessor managing the conversation |
Definition at line 195 of file Jason_Fipa_RequestW_Participant.java.
{ //ConvJasonAgent myag = ((ConvMagentixAgArch)Ts.getUserAgArch()).getJasonAgent(); //Conversation conv = myag.getConversationByintID(myProcessor.getConversationID()); Conversation conv = myProcessor.getConversation(); List<Literal> allperc = new ArrayList<Literal>(); String percept = "timetodotask("+conv.initiator.getLocalName()+","+Task+","+conv.jasonConvID+")[source(self)]"; allperc.add(Literal.parseLiteral(percept)); ((ConvMagentixAgArch)Ts.getUserAgArch()).setPerception(allperc); // try { // Protocol_Semaphore.acquire(); // } catch (InterruptedException e) { // e.printStackTrace(); // } conv.aquire_semaphore(); String result = null; if (TaskDesition==Protocol_Template.INFORM_STEP){ result = "INFORM"; }else if (TaskDesition==Protocol_Template.FAILURE_STEP){ result = "FAILURE"; } return result; }
void es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doAgree | ( | ConvCProcessor | myProcessor, |
ACLMessage | messageToSend | ||
) | [protected] |
Sets the agree message
myProcessor | the CProcessor managing the conversation |
messageToSend | agree message |
Definition at line 175 of file Jason_Fipa_RequestW_Participant.java.
{
messageToSend.setProtocol("request-when");
messageToSend.setPerformative(ACLMessage.AGREE);
messageToSend.setSender(myProcessor.getMyAgent().getAid());
messageToSend.setReceiver(myProcessor.getLastReceivedMessage().getSender());
}
void es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doBegin | ( | CProcessor | myProcessor, |
ACLMessage | msg | ||
) | [protected] |
Method executed at the beginning of the conversation
myProcessor | the CProcessor managing the conversation |
msg | first message assigned to this conversation |
Definition at line 63 of file Jason_Fipa_RequestW_Participant.java.
{
myProcessor.getInternalData().put("InitialMessage", msg);
}
void es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doFailure | ( | ConvCProcessor | myProcessor, |
ACLMessage | messageToSend | ||
) | [protected] |
Sets the failure message
myProcessor | the CProcessor managing the conversation |
messageToSend | failure message |
Definition at line 239 of file Jason_Fipa_RequestW_Participant.java.
{
messageToSend.setProtocol("request-when");
messageToSend.setPerformative(ACLMessage.FAILURE);
messageToSend.setSender(myProcessor.getMyAgent().getAid());
messageToSend.setReceiver(myProcessor.getLastReceivedMessage().getSender());
}
void es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doFinal | ( | ConvCProcessor | myProcessor, |
ACLMessage | messageToSend | ||
) | [protected] |
Method executed when the conversation ends
myProcessor | the CProcessor managing the conversation |
messageToSend | final message |
Definition at line 281 of file Jason_Fipa_RequestW_Participant.java.
{ }
void es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doInform | ( | ConvCProcessor | myProcessor, |
ACLMessage | response | ||
) | [protected] |
Sets the inform message
myProcessor | the CProcessor managing the conversation |
response | inform message |
Definition at line 259 of file Jason_Fipa_RequestW_Participant.java.
{ response.setProtocol("request-when"); response.setPerformative(ACLMessage.INFORM); response.setContent(TaskResult); }
void es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doNotUnderstood | ( | ConvCProcessor | myProcessor, |
ACLMessage | messageToSend | ||
) | [protected] |
Sets the not-understood message
myProcessor | the CProcessor managing the conversation |
messageToSend | not-understood message |
Definition at line 135 of file Jason_Fipa_RequestW_Participant.java.
{
messageToSend.setProtocol("request-when");
messageToSend.setPerformative(ACLMessage.NOT_UNDERSTOOD);
messageToSend.setSender(myProcessor.getMyAgent().getAid());
messageToSend.setReceiver(myProcessor.getLastReceivedMessage().getSender());
}
String es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doReceiveRequest | ( | ConvCProcessor | myProcessor, |
ACLMessage | request | ||
) | [protected] |
Method executed when the initiator receives the request
myProcessor | the CProcessor managing the conversation |
request | request message |
Definition at line 80 of file Jason_Fipa_RequestW_Participant.java.
{ String jasonID = request.getHeaderValue("jasonID"); //Conversation conv = new Conversation(myProcessor, jasonID,myProcessor.getConversationID()); //ConvJasonAgent myag = ((ConvMagentixAgArch)Ts.getUserAgArch()).getJasonAgent(); //myag.insertConversation(conv); Conversation conv = myProcessor.getConversation(); conv.jasonConvID = jasonID; conv.initiator = request.getSender(); List<Literal> allperc = new ArrayList<Literal>(); Task = request.getContent(); String percept = "request("+request.getSender().name+","+Task+","+jasonID+")[source(self)]"; allperc.add(Literal.parseLiteral(percept)); ((ConvMagentixAgArch)Ts.getUserAgArch()).setPerception(allperc); // try { // Protocol_Semaphore.acquire(); // } catch (InterruptedException e) { // e.printStackTrace(); // } //myag.getConversationByintID(myProcessor.getConversationID()).aquire_semaphore(); conv.aquire_semaphore(); String result = null; if (RequestResult==Protocol_Template.AGREE_STEP){ result = "AGREE"; }else if (RequestResult==Protocol_Template.REFUSE_STEP){ result = "REFUSE"; }else if (RequestResult==Protocol_Template.NOT_UNDERSTOOD_STEP){ result = "NOT_UNDERSTOOD"; } return result; }
void es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.doRefuse | ( | ConvCProcessor | myProcessor, |
ACLMessage | messageToSend | ||
) | [protected] |
Sets the refuse message
myProcessor | |
messageToSend |
Definition at line 155 of file Jason_Fipa_RequestW_Participant.java.
{
messageToSend.setProtocol("request-when");
messageToSend.setPerformative(ACLMessage.REFUSE);
messageToSend.setSender(myProcessor.getMyAgent().getAid());
messageToSend.setReceiver(myProcessor.getLastReceivedMessage().getSender());
}
ConvCFactory es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.newFactory | ( | String | name, |
MessageFilter | filter, | ||
int | availableConversations, | ||
ConvJasonAgent | myAgent | ||
) |
Creates a new participant fipa request factory
name | factory's name |
filter | message filter |
availableConversations | maximum number of conversation this CFactory can manage simultaneously |
myAgent | agent owner of this CFactory |
Definition at line 298 of file Jason_Fipa_RequestW_Participant.java.
{ //MessageFilter filter; ACLMessage template; // Create factory if (filter == null) { filter = new MessageFilter("performative = REQUEST AND protocol = request-when"); } //template.setProtocol("REQUEST"); //template.setPerformative(ACLMessage.REQUEST); ConvCFactory theFactory = new ConvCFactory(name, filter, availableConversations, myAgent); // Processor template setup ConvCProcessor processor = theFactory.cProcessorTemplate(); // BEGIN State BeginState BEGIN = (BeginState) processor.getState("BEGIN"); BEGIN.setMethod(new BEGIN_Method()); // WAIT State processor.registerState(new WaitState("WAIT", 0)); processor.addTransition("BEGIN", "WAIT"); // RECEIVE_REQUEST State ReceiveState RECEIVE_REQUEST = new ReceiveState("RECEIVE_REQUEST"); RECEIVE_REQUEST.setMethod(new RECEIVE_REQUEST_Method()); filter = new MessageFilter("performative = REQUEST"); RECEIVE_REQUEST.setAcceptFilter(filter); processor.registerState(RECEIVE_REQUEST); processor.addTransition("WAIT", "RECEIVE_REQUEST"); // NOT_UNDERSTOOD State SendState NOT_UNDERSTOOD = new SendState("NOT_UNDERSTOOD"); NOT_UNDERSTOOD.setMethod(new NOT_UNDERSTOOD_Method()); template = new ACLMessage(ACLMessage.NOT_UNDERSTOOD); template.setProtocol("request-when"); template.setPerformative(ACLMessage.INFORM); NOT_UNDERSTOOD.setMessageTemplate(template); processor.registerState(NOT_UNDERSTOOD); processor.addTransition("RECEIVE_REQUEST", "NOT_UNDERSTOOD"); // REFUSE State SendState REFUSE = new SendState("REFUSE"); REFUSE.setMethod(new REFUSE_Method()); template = new ACLMessage(ACLMessage.REFUSE); template.setProtocol("request-when"); template.setPerformative(ACLMessage.INFORM); REFUSE.setMessageTemplate(template); processor.registerState(REFUSE); processor.addTransition("RECEIVE_REQUEST", "REFUSE"); // AGREE State SendState AGREE = new SendState("AGREE"); AGREE.setMethod(new AGREE_Method()); template = new ACLMessage(ACLMessage.AGREE); template.setProtocol("request-when"); template.setPerformative(ACLMessage.AGREE); AGREE.setMessageTemplate(template); processor.registerState(AGREE); processor.addTransition("RECEIVE_REQUEST", "AGREE"); // ACTION State ActionState ACTION = new ActionState("ACTION"); ACTION.setMethod(new ACTION_Method()); processor.registerState(ACTION); processor.addTransition("AGREE", "ACTION"); // FAILURE State SendState FAILURE = new SendState("FAILURE"); FAILURE.setMethod(new FAILURE_Method()); template = new ACLMessage(ACLMessage.FAILURE); template.setProtocol("request-when"); FAILURE.setMessageTemplate(template); processor.registerState(FAILURE); processor.addTransition("ACTION", "FAILURE"); // INFORM State SendState INFORM = new SendState("INFORM"); INFORM.setMethod(new INFORM_Method()); template = new ACLMessage(ACLMessage.INFORM); template.setProtocol("request-when"); INFORM.setMessageTemplate(template); processor.registerState(INFORM); processor.addTransition("ACTION", "INFORM"); // FINAL State FinalState FINAL = new FinalState("FINAL"); FINAL.setMethod(new FINAL_Method()); processor.registerState(FINAL); processor.addTransition("NOT_UNDERSTOOD", "FINAL"); processor.addTransition("REFUSE", "FINAL"); processor.addTransition("FAILURE", "FINAL"); processor.addTransition("INFORM", "FINAL"); // Thath's all return theFactory; }
String es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.RequestResult = "" |
Definition at line 46 of file Jason_Fipa_RequestW_Participant.java.
String es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.Task = "" |
Definition at line 47 of file Jason_Fipa_RequestW_Participant.java.
String es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.TaskDesition = "" |
Definition at line 45 of file Jason_Fipa_RequestW_Participant.java.
String es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.TaskResult = "" |
Definition at line 44 of file Jason_Fipa_RequestW_Participant.java.
int es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.TimeOut |
Definition at line 41 of file Jason_Fipa_RequestW_Participant.java.
TransitionSystem es.upv.dsic.gti_ia.jason.conversationsFactory.participant.Jason_Fipa_RequestW_Participant.Ts [protected] |
Definition at line 39 of file Jason_Fipa_RequestW_Participant.java.